
import Mock from 'mockjs'

const goods = Mock.mock({
  'list|15': [{
    'id|+1': 1,
    number: '@natural(1000, 9999)',
    'spec': [{ attr: '规格', val: 'H:7.8 D:9.6' }],
    name: '@ctitle(6, 14)',
    'location|1': ['JN3', 'J门旁', 'JBS4'],
    start_price: '@natural(20000, 1000000)',
    resr_price: '@natural(2000000, 100000000)',
    'eval_price|1': ['100万~1000万', '', '8万'],
    'final_price|1': ['@natural(2000000, 100000000)'],
    'postage|1': ['@natural(10000, 100000)'],
    'year|1': ['清代', ''],
    'remark|1': ['@ctitle(8, 14)', ''],
    'state|+1': [-1, 0, 1, 3, 4, 5, 6, 7, 8, 9],
    is_break: '@natural(0, 1)',
    send_user: '@cname',
    'buy_user|1': [102, '易胡代拍', ''],
    'buy_num|1': ['@natural(1, 999)', ''],
    is_company: true
  }],
  lot_name: '@ctitle(8, 10)',
  total: 30
})

const detail = Mock.mock({
  id: 1,
  lid: 1,
  us_id: 1,
  number: '@natural(1000, 9999)',
  name: '@ctitle(6, 14)',
  'classname|1': ['字画名品', ''],
  'year|1': ['清代', ''],
  'size|1': ['H:7.8 D:9.6', ''],
  'recommend|1': ['@ctitle(6, 14)', ''],
  'lib_number|1': ['@natural(1000, 9999)', ''],
  'location|1': ['JN3', 'J门旁', 'JBS4'],
  'style|1': ['@ctitle(6, 14)', ''],
  'author|1': ['@cname', ''],
  'summary|1': ['@ctitle(6, 200)', ''],
  'report|1': ['@ctitle(6, 200)', ''],
  'appendix|1': ['@ctitle(6, 40)', ''],
  'level|1': ['@natural(0, 10)', ''],
  'start|1': ['@natural(1, 100000)', ''],
  'resr_price|1': ['@natural(2000000, 100000000)', ''],
  'begin_price|1': ['@natural(100000, 100000000)', ''],
  'end_price|1': ['@natural(100000, 100000000)', ''],
  'postage|1': ['@natural(10000, 100000)', ''],
  'remark|1': ['@ctitle(6, 140)', ''],
  'img|0-4': [{ url: '@image("200x100", "#4A7BF7", "Hello")' }],
  'append_img|0-4': [{ url: '@image("200x100", "#50B347", "Hello")' }]
})

export default [
  {
    url: '/goods/getGoods',
    type: 'get',
    response: config => {
      return {
        code: 200,
        data: goods
      }
    }
  },
  {
    url: '/goods/batchImport',
    type: 'post',
    response: config => {
      return {
        code: 200,
        data: 88,
        msg: '123件拍品导入成功'
      }
    }
  },
  {
    url: '/goods/setGoodsBreak',
    type: 'post',
    response: config => {
      return {
        code: 200,
        data: {},
        msg: '拍品状态更新成功'
      }
    }
  },
  {
    url: '/goods/setGoodsState',
    type: 'post',
    response: config => {
      return {
        code: 200,
        data: {},
        msg: '拍品状态更新成功'
      }
    }
  },
  {
    url: '/goods/passGoodsBuyNum',
    type: 'post',
    response: config => {
      return {
        code: 200,
        data: {},
        msg: '审核成功'
      }
    }
  },
  {
    url: '/goods/setGoodsStateMulti',
    type: 'post',
    response: config => {
      return {
        code: 200,
        data: {},
        msg: '拍品状态更新成功'
      }
    }
  },
  {
    url: '/goods/get1GoodsDetail',
    type: 'get',
    response: config => {
      return {
        code: 200,
        data: detail
      }
    }
  },
  {
    url: '/goods/updateGoods',
    type: 'post',
    response: config => {
      return {
        code: 200,
        data: goods.list[0],
        msg: '拍品更新成功'
      }
    }
  },
  {
    url: '/goods/delGoodsImg',
    type: 'post',
    response: config => {
      return {
        code: 200,
        msg: '图片删除成功'
      }
    }
  },
  {
    url: '/goods/getConsigns',
    type: 'get',
    response: config => {
      var data = Mock.mock({
        'list|0-20': [{
          'id|+1': 1,
          gnumber: '@natural(1000, 9999)',
          gname: '@ctitle(10, 20)',
          bnumer: '@natural(1000, 9999)',
          bprice: '@natural(20000, 1000000)',
          lot_name: '古龙会专场'
        }],
        total: 88
      })
      return {
        code: 200,
        data: data
      }
    }
  },
  {
    url: '/goods/exportDealGoods',
    type: 'get',
    response: config => {
      return {
        code: 200,
        data: 'http://auction.kireido.com/static/001.xls'
      }
    }
  },
]
